/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fgv.tcc.fgv.imovel.service;

import java.io.StringWriter;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import javax.json.JsonWriter;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

/**
 *
 * @author diego
 */
@Path("person")
public class PersonResource {

    public PersonResource() {
    }

    @GET
    @Produces("application/json")
    public String getJson() {
        JsonObjectBuilder builder = Json.createObjectBuilder();
        builder.add("person", Json.createObjectBuilder()
                .add("firstName", "Markus")
                .add("lastName", "Eisele"));
        JsonObject result = builder.build();
        StringWriter sw = new StringWriter();
        try (JsonWriter writer = Json.createWriter(sw)) {
            writer.writeObject(result);
        }
        return sw.toString();
    }
}
